package Exam;

import java.util.Comparator;
import java.util.TreeSet;

/**
 * @author げっしょく
 * @date 2021/7/26
 */
public class Test6 {
    public static void main(String[] args) {
        TreeSet<Student> list = new TreeSet<>(/*new Comparator<Student>() {
            @Override
            public int compare(Student o1, Student o2) {
                int result = o1.getScor() - o2.getScor();
                result = result == 0 ? o1.getAge() - o2.getAge() : result;
                result = result == 0? o1.getName().compareTo(o2.getName()) : result;

                return result;
            }
        }*/);
        Student stu = new Student("zhangsan",240, 20);
        Student stu2 = new Student("lisi", 190,20);
        Student stu3 = new Student("wangwu",240, 18);
        Student stu4 = new Student("zhaoliu",160, 20);
        list.add(stu);
        list.add(stu2);
        list.add(stu3);
        list.add(stu4);
        System.out.println(list);

    }
}
